package com.qiyu.dubbo.router.starter;

import com.qiyu.dubbo.common.DubboService;
import com.qiyu.dubbo.router.starter.config.DubboCommonConfig;
import com.qiyu.dubbo.router.starter.service.impl.DubboServiceImpl;
import org.apache.dubbo.config.ApplicationConfig;
import org.apache.dubbo.config.ProtocolConfig;
import org.apache.dubbo.config.RegistryConfig;
import org.apache.dubbo.config.ServiceConfig;

/**
 * @Author idea
 * @Date created in 5:32 下午 2020/11/25
 */
//@SpringBootApplication
//@EnableDubbo
public class ProviderApplication {

    public static void main(String[] args) {
        ApplicationConfig applicationConfig= DubboCommonConfig.buildApplication("order-provider");
        RegistryConfig registryConfig=DubboCommonConfig.buildRegistryConfig();
        ProtocolConfig protocolConfig= DubboCommonConfig.buildProtocolConfig(9096);
        ServiceConfig<DubboService> serviceServiceConfig = DubboCommonConfig.buildServiceConfig(applicationConfig,registryConfig,protocolConfig,DubboService.class,new DubboServiceImpl());
        serviceServiceConfig.export();
        System.out.println("服务暴露ing");
        while (true){

        }
//        SpringApplication.run(ProviderApplication.class);
//        System.out.println("dubbo server start!!");
//        RegistryFactory registryFactory = ExtensionLoader.getExtensionLoader(RegistryFactory.class).getExtension("zoneAware");
//        Cluster cluster = ExtensionLoader.getExtensionLoader(Cluster.class).getExtension("zoneAware");
//        System.out.println(registryFactory.getClass());
//        System.out.println(cluster.getClass());
    }
}
